package logic.SysOrganizationalRole

import cn.ibizlab.util.domain.EntityBase
import cn.ibizlab.util.helper.RuleUtils
import cn.ibizlab.util.security.AuthenticationUser
import cn.ibizlab.util.security.SpringContextHolder
import cn.ibizlab.core.ad.domain.SysOrganizationalRole
import cn.ibizlab.core.ad.service.SysOrganizationalRoleService
import com.alibaba.fastjson.JSONObject
import org.springframework.util.ObjectUtils

/**
 *  设置OU
 */
class SetOu {

    //当前用户
    def curuser = AuthenticationUser.getAuthenticationUser()
    //传入变量
    def _default
    //返回参数
    def _return

    def execute(arg) {
        println 'running....'
        _default = arg
        _return = arg
        begin()
        println 'running end....'
        return _return
    }

    //开始
    def begin() {
    
        //deptid为空
        if(((RuleUtils.test(_default.get('department_id'), 'ISNULL', 'null')))) {
            prepareparam2()
        }
        //deptid不为空
        if(((RuleUtils.test(_default.get('department_id'), 'ISNOTNULL', 'null')))) {
            prepareparam1()
        }
    }

    //orgid->ouid
    def prepareparam2() {
        _default.set("organizational_unit_id", _default.get("organization_id"))

        if(true) {
            end1()
        }
    }

    //deptiid->ouid
    def prepareparam1() {
        _default.set("organizational_unit_id", _default.get("department_id"))

        if(true) {
            end1()
        }
    }

    //结束
    def end1() {

    }

}
